<template>
	<van-list
		v-model="loading"
		:finished="finished"
		:loading-text="i18n.common.loading"
		:finished-text="i18n.common.no_more"
		@load="onLoad2">
		<view class="cu-list menu-avatar">
			<view v-for="(item,index) in fightRecordList" :key="index" class="cu-item" style="height: 300rpx;" @click="lotteryDetail(item)">
				<view class="cu-avatar round lg"
					:style="'background-image:url('+item.win_user_map.user_header+');'">
				</view>
				<view class="content">
					<view class="text-grey" style="font-size: 13px">{{item.win_user_map.nick_name}}</view>
					<view class="text-gray text-sm ">
						<view class="text-cut f12">
							<!-- <text class="cuIcon-infofill text-red  margin-right-xs"></text> -->
							<!-- 期号： -->
							{{i18n.home_page.good_details.t42}}：{{item.good_period}}
						</view>
						<view class="text-cut f12">
							<!-- <text class="cuIcon-infofill text-red  margin-right-xs"></text> -->
							<!-- 本期参与：  次 -->
							{{i18n.home_page.good_details.t43}}：<text class="text-warning">{{item.win_user_map.fight_time}}{{i18n.common.ci}}</text>
						</view>
						<view class="text-cut f12">
							<!-- <text class="cuIcon-infofill text-red  margin-right-xs"></text> -->
							<!-- 中奖号码： -->
							{{i18n.home_page.good_details.t11}}：<text class="text-warning">{{item.win_num}}</text>
						</view>
						<view class="text-cut f12">
							<!-- <text class="cuIcon-infofill text-red  margin-right-xs"></text> -->
							<!-- 开奖时间： -->
							{{i18n.user_page.lottery_order.t10}}：{{item.lottery_time}}
						</view>
					</view>
				</view>
				<view class=" d-flex flex-column  mb-auto py-4">
					<view class="f12 c-red" style="margin-right: 26upx">
						<!-- <image style="width: 90rpx;height: 30rpx;" src="/static/img/huojiangzhe.png"></image> -->
						<!-- 获奖者 -->
						{{i18n.home_page.tips.t7}}
					</view>
					<view class="py-1" style="position: absolute;bottom: 10;right: 13;">
						<van-icon name="arrow" />
					</view>
				</view>
			</view>
		</view>
	</van-list>
</template>

<script>
	import {
		getHistoryList
	} from '@/api/lottery.js';

	export default {
		props: ['good_id'],
		data() {
			return {
				//当前页码数
				currentPage: 1,
				loading: false,
				finished: false,
				//抽奖列表信息
				fightRecordList: []
			}
		},
		computed: {
			i18n() {
				return this.$t("index")
			}
		},
		methods: {
			onLoad2() {
				let data = {
					good_id: this.good_id,
					page: this.currentPage,
					limitNum: 10
				};
				let that = this;
				getHistoryList(data).then(res => {
					that.loading = false;
					if (res == undefined || res.length <= 0) {
						that.finished = true;
						return;
					}
					res.forEach(item => {
						that.fightRecordList.push(item);
					})
					//console.log(that.fightRecordList)
					that.currentPage = that.currentPage + 1;
				});
			},
			//请求抽奖详情页面
			lotteryDetail(item) {
				console.log(item.id)
				uni.navigateTo({
					url: '/pages/lottery/good_details/good_details?id=' + item.id
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
@import "@/common/font.css";
</style>

